package com.example.qxfw.ybzz.service.impl;

import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.example.qxfw.common.entity.xt.YbzzStationConfig;
import com.example.qxfw.ybzz.mapper.YbzzStationConfigMapper;
import com.example.qxfw.ybzz.service.YbzzStationConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class YbzzStationConfigServiceImpl implements YbzzStationConfigService {

    @Autowired
    private YbzzStationConfigMapper ybzzStationConfigMapper;

    @Override
    public List<YbzzStationConfig> getList() {
        List<YbzzStationConfig> ybzzStationConfigs = ybzzStationConfigMapper.selectList(null);
        return ybzzStationConfigs;
    }

    @Override
    public Integer updateByType(YbzzStationConfig ybzzStationConfig) {
        String type = ybzzStationConfig.getStrtype();
        ybzzStationConfig.setStrtype(null);
        LambdaUpdateWrapper<YbzzStationConfig> updateWrapper = new LambdaUpdateWrapper<>();
        updateWrapper.eq(YbzzStationConfig::getStrtype,type);
        int rows = ybzzStationConfigMapper.update(ybzzStationConfig,updateWrapper);
        return rows;
    }

}
